using System;
using System.Collections.Generic;
using System.Text;
namespace Test {
	public class Ins {
		string _tableName;
		Dictionary<string,object> _dict=new Dictionary<string,object>();
		public Ins(string tableName) {
			_tableName=tableName;
		}
		public void Add(string colName,object obj) {
			_dict.Add(colName,obj);
		}
		public override string ToString() {
			string[] cols=new string[_dict.Count];
			string[] vals=new string[_dict.Count];
			int cnt=0;
			foreach(KeyValuePair<string,object> kvp in _dict)
			{
				cols[cnt]=kvp.Key;
				string val="";
				if(kvp.Value==null)
					val="null";
				else
				{
					Type t=kvp.Value.GetType();
					if(t==typeof(string)||t==typeof(char))
						val=string.Concat("'",kvp.Value.ToString().Replace("'","''"),"'");
					else
						val=kvp.Value.ToString();
				}
				vals[cnt]=val;
				cnt++;
			}
			return string.Format("insert into {0}({1})values({2})",_tableName,string.Join(",",cols),string.Join(",",vals));
		}
	}
	public class InsL {
	}
}
